package structure

import (
	"fmt"
	"strconv"
	"time"
)

func check_pointer() {

	m := make(map[*int]int)

	k1 := 1
	k2 := 1
	m[&k1] = 1
	m[&k2] = 1
	fmt.Println(&k1)
	for k, v := range m {
		k1 = 5
		fmt.Println("k:", *k, "\t v", v)
	}
	go func() {
		fmt.Println(&k1)
	}()
	time.Sleep(1)
}

func delKey() {
	_map := make(map[string]*string)

	//mock
	for i := 0; i < 5; i++ {
		pointer := strconv.Itoa(1 << i)
		_map[strconv.Itoa(i)] = &pointer
	}

	//log.Println("before: ", _map)
	//del key 0
	delete(_map, "0")
	//log.Println("after: ", _map)
}

func mapLen() {
	_m := make(map[string]int32, 100)

	_m["first"] = 1
	fmt.Println(len(_m)) //used space
}
